﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//请先添加引用
namespace EnterpriseFund.DAL
{
    /// <summary>
    /// 数据访问类Entity。
    /// </summary>
    public class Entity
    {
        public Entity()
        { }
        #region  成员方法

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string FEntityNo)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from t_Entity");
            strSql.Append(" where FEntityNo=@FEntityNo ");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.NVarChar,50)};
            parameters[0].Value = FEntityNo;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Model.Entity model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into t_Entity(");
            strSql.Append("FEntityNo,FEntityName,FLeader,FShortName,FAccessDate,FLastLoginIPAddr,FLogID,fuseTimes,FPublishRoot,FWaterMarkContent,FWaterMarkSvrFileName,FWaterMarkExt,FWaterMarkOldFileName,FWebBeiAnNo,FCopyRight,FTxtWaterMark,FSmtpHost,FSmtpAccount,FSmtpPassword,FWaterMarkCls,FSmtpPort,FIsSsl,FFlowLockTime,FIsIPControl)");
            strSql.Append(" values (");
            strSql.Append("@FEntityNo,@FEntityName,@FLeader,@FShortName,@FAccessDate,@FLastLoginIPAddr,@FLogID,@fuseTimes,@FPublishRoot,@FWaterMarkContent,@FWaterMarkSvrFileName,@FWaterMarkExt,@FWaterMarkOldFileName,@FWebBeiAnNo,@FCopyRight,@FTxtWaterMark,@FSmtpHost,@FSmtpAccount,@FSmtpPassword,@FWaterMarkCls,@FSmtpPort,@FIsSsl,@FFlowLockTime,@FIsIPControl)");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.NVarChar,12),
					new SqlParameter("@FEntityName", SqlDbType.NVarChar,50),
					new SqlParameter("@FLeader", SqlDbType.NVarChar,10),
					new SqlParameter("@FShortName", SqlDbType.NVarChar,20),
					new SqlParameter("@FAccessDate", SqlDbType.DateTime),
					new SqlParameter("@FLastLoginIPAddr", SqlDbType.VarChar,15),
					new SqlParameter("@FLogID", SqlDbType.NVarChar,30),
					new SqlParameter("@fuseTimes", SqlDbType.Int,4),
					new SqlParameter("@FPublishRoot", SqlDbType.NVarChar,255),
					new SqlParameter("@FWaterMarkContent", SqlDbType.Image,16),
					new SqlParameter("@FWaterMarkSvrFileName", SqlDbType.NVarChar,255),
					new SqlParameter("@FWaterMarkExt", SqlDbType.NVarChar,80),
					new SqlParameter("@FWaterMarkOldFileName", SqlDbType.NVarChar,255),
					new SqlParameter("@FWebBeiAnNo", SqlDbType.NVarChar,255),
					new SqlParameter("@FCopyRight", SqlDbType.NText),
					new SqlParameter("@FTxtWaterMark", SqlDbType.NVarChar,20),
					new SqlParameter("@FSmtpHost", SqlDbType.NVarChar,80),
					new SqlParameter("@FSmtpAccount", SqlDbType.NVarChar,80),
					new SqlParameter("@FSmtpPassword", SqlDbType.NVarChar,30),
					new SqlParameter("@FWaterMarkCls", SqlDbType.NChar,1),
					new SqlParameter("@FSmtpPort", SqlDbType.Int,4),
					new SqlParameter("@FIsSsl", SqlDbType.Decimal,5),
					new SqlParameter("@FFlowLockTime", SqlDbType.Int,4),
					new SqlParameter("@FIsIPControl", SqlDbType.NChar,1)};
            parameters[0].Value = model.FEntityNo;
            parameters[1].Value = model.FEntityName;
            parameters[2].Value = model.FLeader;
            parameters[3].Value = model.FShortName;
            parameters[4].Value = model.FAccessDate;
            parameters[5].Value = model.FLastLoginIPAddr;
            parameters[6].Value = model.FLogID;
            parameters[7].Value = model.fuseTimes;
            parameters[8].Value = model.FPublishRoot;
            parameters[9].Value = model.FWaterMarkContent;
            parameters[10].Value = model.FWaterMarkSvrFileName;
            parameters[11].Value = model.FWaterMarkExt;
            parameters[12].Value = model.FWaterMarkOldFileName;
            parameters[13].Value = model.FWebBeiAnNo;
            parameters[14].Value = model.FCopyRight;
            parameters[15].Value = model.FTxtWaterMark;
            parameters[16].Value = model.FSmtpHost;
            parameters[17].Value = model.FSmtpAccount;
            parameters[18].Value = model.FSmtpPassword;
            parameters[19].Value = model.FWaterMarkCls;
            parameters[20].Value = model.FSmtpPort;
            parameters[21].Value = model.FIsSsl;
            parameters[22].Value = model.FFlowLockTime;
            parameters[23].Value = model.FIsIPControl;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Model.Entity model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update t_Entity set ");
            strSql.Append("FEntityName=@FEntityName,");
            strSql.Append("FLeader=@FLeader,");
            strSql.Append("FShortName=@FShortName,");
            strSql.Append("FAccessDate=@FAccessDate,");
            strSql.Append("FLastLoginIPAddr=@FLastLoginIPAddr,");
            strSql.Append("FLogID=@FLogID,");
            strSql.Append("fuseTimes=@fuseTimes,");
            strSql.Append("FPublishRoot=@FPublishRoot,");
            strSql.Append("FWaterMarkContent=@FWaterMarkContent,");
            strSql.Append("FWaterMarkSvrFileName=@FWaterMarkSvrFileName,");
            strSql.Append("FWaterMarkExt=@FWaterMarkExt,");
            strSql.Append("FWaterMarkOldFileName=@FWaterMarkOldFileName,");
            strSql.Append("FWebBeiAnNo=@FWebBeiAnNo,");
            strSql.Append("FCopyRight=@FCopyRight,");
            strSql.Append("FTxtWaterMark=@FTxtWaterMark,");
            strSql.Append("FSmtpHost=@FSmtpHost,");
            strSql.Append("FSmtpAccount=@FSmtpAccount,");
            strSql.Append("FSmtpPassword=@FSmtpPassword,");
            strSql.Append("FWaterMarkCls=@FWaterMarkCls,");
            strSql.Append("FSmtpPort=@FSmtpPort,");
            strSql.Append("FIsSsl=@FIsSsl,");
            strSql.Append("FFlowLockTime=@FFlowLockTime,");
            strSql.Append("FIsIPControl=@FIsIPControl");
            strSql.Append(" where FEntityNo=@FEntityNo ");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.NVarChar,12),
					new SqlParameter("@FEntityName", SqlDbType.NVarChar,50),
					new SqlParameter("@FLeader", SqlDbType.NVarChar,10),
					new SqlParameter("@FShortName", SqlDbType.NVarChar,20),
					new SqlParameter("@FAccessDate", SqlDbType.DateTime),
					new SqlParameter("@FLastLoginIPAddr", SqlDbType.VarChar,15),
					new SqlParameter("@FLogID", SqlDbType.NVarChar,30),
					new SqlParameter("@fuseTimes", SqlDbType.Int,4),
					new SqlParameter("@FPublishRoot", SqlDbType.NVarChar,255),
					new SqlParameter("@FWaterMarkContent", SqlDbType.Image,16),
					new SqlParameter("@FWaterMarkSvrFileName", SqlDbType.NVarChar,255),
					new SqlParameter("@FWaterMarkExt", SqlDbType.NVarChar,80),
					new SqlParameter("@FWaterMarkOldFileName", SqlDbType.NVarChar,255),
					new SqlParameter("@FWebBeiAnNo", SqlDbType.NVarChar,255),
					new SqlParameter("@FCopyRight", SqlDbType.NText),
					new SqlParameter("@FTxtWaterMark", SqlDbType.NVarChar,20),
					new SqlParameter("@FSmtpHost", SqlDbType.NVarChar,80),
					new SqlParameter("@FSmtpAccount", SqlDbType.NVarChar,80),
					new SqlParameter("@FSmtpPassword", SqlDbType.NVarChar,30),
					new SqlParameter("@FWaterMarkCls", SqlDbType.NChar,1),
					new SqlParameter("@FSmtpPort", SqlDbType.Int,4),
					new SqlParameter("@FIsSsl", SqlDbType.Decimal,5),
					new SqlParameter("@FFlowLockTime", SqlDbType.Int,4),
					new SqlParameter("@FIsIPControl", SqlDbType.NChar,1)};
            parameters[0].Value = model.FEntityNo;
            parameters[1].Value = model.FEntityName;
            parameters[2].Value = model.FLeader;
            parameters[3].Value = model.FShortName;
            parameters[4].Value = model.FAccessDate;
            parameters[5].Value = model.FLastLoginIPAddr;
            parameters[6].Value = model.FLogID;
            parameters[7].Value = model.fuseTimes;
            parameters[8].Value = model.FPublishRoot;
            parameters[9].Value = model.FWaterMarkContent;
            parameters[10].Value = model.FWaterMarkSvrFileName;
            parameters[11].Value = model.FWaterMarkExt;
            parameters[12].Value = model.FWaterMarkOldFileName;
            parameters[13].Value = model.FWebBeiAnNo;
            parameters[14].Value = model.FCopyRight;
            parameters[15].Value = model.FTxtWaterMark;
            parameters[16].Value = model.FSmtpHost;
            parameters[17].Value = model.FSmtpAccount;
            parameters[18].Value = model.FSmtpPassword;
            parameters[19].Value = model.FWaterMarkCls;
            parameters[20].Value = model.FSmtpPort;
            parameters[21].Value = model.FIsSsl;
            parameters[22].Value = model.FFlowLockTime;
            parameters[23].Value = model.FIsIPControl;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(string FEntityNo)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from t_Entity ");
            strSql.Append(" where FEntityNo=@FEntityNo ");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.NVarChar,50)};
            parameters[0].Value = FEntityNo;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Entity GetModel(string FEntityNo)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 FEntityNo,FEntityName,FLeader,FShortName,FAccessDate,FLastLoginIPAddr,FLogID,fuseTimes,FPublishRoot,FWaterMarkContent,FWaterMarkSvrFileName,FWaterMarkExt,FWaterMarkOldFileName,FWebBeiAnNo,FCopyRight,FTxtWaterMark,FSmtpHost,FSmtpAccount,FSmtpPassword,FWaterMarkCls,FSmtpPort,FIsSsl,FFlowLockTime,FIsIPControl,FNtkoCaption,FNtkoKey,FSysTitle,FSysCopyRight from t_Entity ");
            strSql.Append(" where FEntityNo=@FEntityNo ");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.NVarChar,50)};
            parameters[0].Value = FEntityNo;

            Model.Entity model = new Model.Entity();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.FEntityNo = ds.Tables[0].Rows[0]["FEntityNo"].ToString();
                model.FEntityName = ds.Tables[0].Rows[0]["FEntityName"].ToString();
                model.FLeader = ds.Tables[0].Rows[0]["FLeader"].ToString();
                model.FShortName = ds.Tables[0].Rows[0]["FShortName"].ToString();
                if (ds.Tables[0].Rows[0]["FAccessDate"].ToString() != "")
                {
                    model.FAccessDate = DateTime.Parse(ds.Tables[0].Rows[0]["FAccessDate"].ToString());
                }
                model.FLastLoginIPAddr = ds.Tables[0].Rows[0]["FLastLoginIPAddr"].ToString();
                model.FLogID = ds.Tables[0].Rows[0]["FLogID"].ToString();
                if (ds.Tables[0].Rows[0]["fuseTimes"].ToString() != "")
                {
                    model.fuseTimes = int.Parse(ds.Tables[0].Rows[0]["fuseTimes"].ToString());
                }
                model.FPublishRoot = ds.Tables[0].Rows[0]["FPublishRoot"].ToString();
                if (ds.Tables[0].Rows[0]["FWaterMarkContent"].ToString() != "")
                {
                    model.FWaterMarkContent = (byte[])ds.Tables[0].Rows[0]["FWaterMarkContent"];
                }
                model.FWaterMarkSvrFileName = ds.Tables[0].Rows[0]["FWaterMarkSvrFileName"].ToString();
                model.FWaterMarkExt = ds.Tables[0].Rows[0]["FWaterMarkExt"].ToString();
                model.FWaterMarkOldFileName = ds.Tables[0].Rows[0]["FWaterMarkOldFileName"].ToString();
                model.FWebBeiAnNo = ds.Tables[0].Rows[0]["FWebBeiAnNo"].ToString();
                model.FCopyRight = ds.Tables[0].Rows[0]["FCopyRight"].ToString();
                model.FTxtWaterMark = ds.Tables[0].Rows[0]["FTxtWaterMark"].ToString();
                model.FSmtpHost = ds.Tables[0].Rows[0]["FSmtpHost"].ToString();
                model.FSmtpAccount = ds.Tables[0].Rows[0]["FSmtpAccount"].ToString();
                model.FSmtpPassword = ds.Tables[0].Rows[0]["FSmtpPassword"].ToString();
                model.FWaterMarkCls = ds.Tables[0].Rows[0]["FWaterMarkCls"].ToString();
                if (ds.Tables[0].Rows[0]["FSmtpPort"].ToString() != "")
                {
                    model.FSmtpPort = int.Parse(ds.Tables[0].Rows[0]["FSmtpPort"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FIsSsl"].ToString() != "")
                {
                    model.FIsSsl = decimal.Parse(ds.Tables[0].Rows[0]["FIsSsl"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FFlowLockTime"].ToString() != "")
                {
                    model.FFlowLockTime = int.Parse(ds.Tables[0].Rows[0]["FFlowLockTime"].ToString());
                }
                model.FIsIPControl = ds.Tables[0].Rows[0]["FIsIPControl"].ToString();
                model.FNtkoCaption = ds.Tables[0].Rows[0]["FNTKOCaption"].ToString();
                model.FNtkoKey = ds.Tables[0].Rows[0]["FNTKOKey"].ToString();
                model.FSysTitle = ds.Tables[0].Rows[0]["FSysTitle"].ToString();
                model.FSysCopyRight = ds.Tables[0].Rows[0]["FSysCopyRight"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select FEntityNo,FEntityName,FLeader,FShortName,FAccessDate,FLastLoginIPAddr,FLogID,fuseTimes,FPublishRoot,FWaterMarkContent,FWaterMarkSvrFileName,FWaterMarkExt,FWaterMarkOldFileName,FWebBeiAnNo,FCopyRight,FTxtWaterMark,FSmtpHost,FSmtpAccount,FSmtpPassword,FWaterMarkCls,FSmtpPort,FIsSsl,FFlowLockTime,FIsIPControl ");
            strSql.Append(" FROM t_Entity ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" FEntityNo,FEntityName,FLeader,FShortName,FAccessDate,FLastLoginIPAddr,FLogID,fuseTimes,FPublishRoot,FWaterMarkContent,FWaterMarkSvrFileName,FWaterMarkExt,FWaterMarkOldFileName,FWebBeiAnNo,FCopyRight,FTxtWaterMark,FSmtpHost,FSmtpAccount,FSmtpPassword,FWaterMarkCls,FSmtpPort,FIsSsl,FFlowLockTime,FIsIPControl ");
            strSql.Append(" FROM t_Entity ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "t_Entity";
            parameters[1].Value = "ID";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  成员方法


        #region 自己增加的方法
        /// <summary>
        /// 更新有关最近登录等相关的信息
        /// </summary>
        public void UpdateByEntityNo(Model.Entity model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update t_Entity set ");
            strSql.Append("FAccessDate=@FAccessDate,");
            strSql.Append("FLastLoginIPAddr=@FLastLoginIPAddr,");
            strSql.Append("FLogID=@FLogID");
            strSql.Append(" where FEntityNo=@FEntityNo");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.VarChar,12),					
					new SqlParameter("@FAccessDate", SqlDbType.DateTime),					
					new SqlParameter("@FLastLoginIPAddr", SqlDbType.VarChar,15),
					new SqlParameter("@FLogID", SqlDbType.VarChar,30)};

            parameters[0].Value = model.FEntityNo;
            parameters[1].Value = model.FAccessDate;
            parameters[2].Value = model.FLastLoginIPAddr;
            parameters[3].Value = model.FLogID;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 更新一条数据,根据EntityNo
        /// </summary>
        public void UpdateSect(Model.Entity model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update t_Entity set ");
            strSql.Append("FEntityName=@FEntityName,");
            strSql.Append("FLeader=@FLeader,");
            strSql.Append("FShortName=@FShortName,");
            strSql.Append("FAccessDate=@FAccessDate,");
            strSql.Append("fuseTimes=@fuseTimes,");
            strSql.Append("FLastLoginIPAddr=@FLastLoginIPAddr,");
            strSql.Append("FLogID=@FLogID,");
            strSql.Append("FPublishRoot=@FPublishRoot,");
            strSql.Append("FWaterMarkContent=@FWaterMarkContent,");
            strSql.Append("FWaterMarkSvrFileName=@FWaterMarkSvrFileName,");
            strSql.Append("FWaterMarkExt=@FWaterMarkExt,");
            strSql.Append("FWaterMarkOldFileName=@FWaterMarkOldFileName,");
            strSql.Append("FWebBeiAnNo=@FWebBeiAnNo,");
            strSql.Append("FCopyRight=@FCopyRight,");
            strSql.Append("FTxtWaterMark=@FTxtWaterMark,");
            strSql.Append("FWaterMarkCls=@FWaterMarkCls,");
            strSql.Append("FSmtpHost=@FSmtpHost,");
            strSql.Append("FSmtpAccount=@FSmtpAccount,");
            strSql.Append("FSmtpPassword=@FSmtpPassword,");
            strSql.Append("FSmtpPort=@FSmtpPort,");
            strSql.Append("FIsSsl=@FIsSsl,");
            strSql.Append("FSysTitle=@FSysTitle");
            strSql.Append(" where FEntityNo=@FEntityNo");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.VarChar,12),
					new SqlParameter("@FEntityName", SqlDbType.VarChar,50),
					new SqlParameter("@FLeader", SqlDbType.VarChar,10),
					new SqlParameter("@FShortName", SqlDbType.VarChar,20),
					new SqlParameter("@FAccessDate", SqlDbType.DateTime),
					new SqlParameter("@fuseTimes", SqlDbType.Int,4),
					new SqlParameter("@FLastLoginIPAddr", SqlDbType.VarChar,15),
					new SqlParameter("@FLogID", SqlDbType.VarChar,30),
					new SqlParameter("@FPublishRoot", SqlDbType.VarChar,255),
					new SqlParameter("@FWaterMarkContent", SqlDbType.Image),
					new SqlParameter("@FWaterMarkSvrFileName", SqlDbType.VarChar,255),
					new SqlParameter("@FWaterMarkExt", SqlDbType.VarChar,80),
					new SqlParameter("@FWaterMarkOldFileName", SqlDbType.VarChar,255),
					new SqlParameter("@FWebBeiAnNo", SqlDbType.VarChar,255),
					new SqlParameter("@FCopyRight", SqlDbType.Text),
					new SqlParameter("@FTxtWaterMark", SqlDbType.VarChar,20),
					new SqlParameter("@FWaterMarkCls", SqlDbType.Char,1),
					new SqlParameter("@FSmtpHost", SqlDbType.VarChar,80),
					new SqlParameter("@FSmtpAccount", SqlDbType.VarChar,80),
					new SqlParameter("@FSmtpPassword", SqlDbType.VarChar,30),
                    new SqlParameter("@FSmtpPort", SqlDbType.Int,4),
					new SqlParameter("@FIsSsl", SqlDbType.Decimal,5),
                    new SqlParameter("@FSysTitle",SqlDbType.NVarChar,200)};
            parameters[0].Value = model.FEntityNo;
            parameters[1].Value = model.FEntityName;
            parameters[2].Value = model.FLeader;
            parameters[3].Value = model.FShortName;
            parameters[4].Value = model.FAccessDate;
            parameters[5].Value = model.fuseTimes + 1;
            parameters[6].Value = model.FLastLoginIPAddr;
            parameters[7].Value = model.FLogID;
            parameters[8].Value = model.FPublishRoot;
            parameters[9].Value = model.FWaterMarkContent;
            parameters[10].Value = model.FWaterMarkSvrFileName;
            parameters[11].Value = model.FWaterMarkExt;
            parameters[12].Value = model.FWaterMarkOldFileName;
            parameters[13].Value = model.FWebBeiAnNo;
            parameters[14].Value = model.FCopyRight;
            parameters[15].Value = model.FTxtWaterMark;
            parameters[16].Value = model.FWaterMarkCls;
            parameters[17].Value = model.FSmtpHost;
            parameters[18].Value = model.FSmtpAccount;
            parameters[19].Value = model.FSmtpPassword;
            parameters[20].Value = model.FSmtpPort;
            parameters[21].Value = model.FIsSsl;
            parameters[22].Value = model.FSysTitle;


            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }

        public void UpdateIpContral(string temp, string EntityNo)
        {
            string sql = "update t_Entity set FIsIPControl='" + temp + "' where FEntityNo='" + EntityNo + "'";
            DbHelperSQL.ExecuteSql(sql);
        }


        /// <summary>
        /// 获取值班人员字符串组合
        /// </summary>
        /// <param name="_strEntityNO"></param>
        /// <param name="_strDay"></param>
        /// <returns></returns>
        public string getWatchScheduleName(string _strEntityNO, string _strDay)
        {
            string _str = "";
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select fempname from HRWatchSchedule_HREmpl where FEntityNo=@FEntityNo and  fworkdate=@FWorkDate order by fseq");
            SqlParameter[] parameters = {
                    new SqlParameter("@FEntityNo", SqlDbType.NVarChar,50),
					new SqlParameter("@FWorkDate", SqlDbType.NVarChar,30)};
            parameters[0].Value = _strEntityNO;
            parameters[1].Value = _strDay;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                while (sdr.Read())
                {
                    _str += sdr[0].ToString() + "   ";
                }
            }


            return _str;
        }

        #endregion


    }
}

